<%@page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>flexigrid</title>
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/scripts/flexigrid/styles.css" />
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/scripts/flexigrid/css/flexigrid/flexigrid.css">
<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/jquery/jquery.min.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/flexigrid/flexigrid.pack.js"></script>
</head>
<body>
<table id="x_grid" style="display: none"></table>
<script type="text/javascript">
			$("#x_grid").flexigrid
			(
			{
			url: 'flexigrid2_xml.jsp',
			dataType: 'xml',
			colModel : [
				{display: '序号', name : 'x_rowNum', width : 60, sortable : false, align: 'left'},
				{display: '功能键', name : 'functionKey', width : 90, sortable : false, align: 'left'},
				{display: '申请人', name: 'applyUser', width: 90, align: 'left'},
				{display: '申请人部门', name: 'applyDept', width: 120, align: 'left'},
				{display: '申请日期', name: 'applyDate', width: 90, align: 'center'},
				{display: '职位', name: 'principalship', width: 120, align: 'left'},
				{display: '英文名', name: 'englishName', width: 120, align: 'left'},
				{display: '电话', name: 'phone', width: 120, align: 'left'},
				{display: '移动电话', name: 'mobile', width: 120, align: 'left'},
				{display: 'E-mail', name: 'email', width: 120, align: 'left'},
				{display: '交付时间', name: 'deliveryDate', sortable: true, width: 90, align: 'center'},
				{display: '申请时间', name: 'applyDate', sortable: true, width: 90, align: 'center'},
				{display: '印制数量', name: 'num', sortable: true, width: 90, align: 'right'},
				{display: '部门审核', name: 'deptOption', width: 120, align: 'left'},
				{display: '公司审批', name: 'commonOpinion', width: 120, align: 'left'},
				{display: '公司审批', name: 'companyOpinion', width: 120, align: 'left'},		 
				{display: '状态  ', name : 'status', width : 90, sortable : false, align: 'center'}
				],
			buttons : [
				{name: '新增', bclass: 'add', onpress : test},
				{name: '删除', bclass: 'delete', onpress : test},
				{separator: true}
				],
			usepager: true,
			title: '产品信息',
			useRp: true,
			rp: 20,
			showTableToggleBtn: true,
			width: 900,
			height: 492
			}
			);
			
			function test(com,grid) {
				if (com=='删除')	{
					 if(confirm('是否删除这 ' + $('.trSelected',grid).length + ' 条记录吗?')) {
						 var  id ="id=";
					     for(var i=0;i<$('.trSelected',grid).length;i++){
					        id +=  $('.trSelected',grid).find("td:first").eq(i).text()+",";
					      }
					      window.location.href="delete.jsp?"+id+"&date="+new Date().getTime(); 
					   }
				} else if (com=='新增') {
					window.location.href="create_product.jsp?date="+new Date().getTime(); 
				}			
			}

      $('b.top').click
		(
			function ()
				{
					$(this).parent().toggleClass('fh');
				}
		);
		</script>
</body>